<?php
require_once '../ptnhuan-web1/libraries/utilites/functions.php';
$file_name = "data/films.txt";
$file_path = realpath($file_name);
$films = array();
$file = fopen($file_path, "r");
while (!feof($file)) {
    $films[] = trim(fgets($file));
}
fclose($file);
?>
<?php foreach ($films as $line): ?>
    <?php if (!empty($line)): ?>
        <?php $films = explode(";", $line); ?>
        <?php if (isset($_GET['uid'])): ?>
            <?php if ((int) $_GET['uid'] == (int) $films[4]): ?>
                <img src="public/images/films/<?php echo$films[1] ?>">
                <a href='edit.php?if='> Edit </a><br>
            <?php endif; ?>
        <?php endif; ?>
    <?php endif; ?>
<?php endforeach; ?>
